import type { CLDialogProps, CLDialogAction } from "../types";

/**
 * @description dialog入口，创建 register 事件函数、方法methods
 * @param  props 需要传入的配置项
 * @returns  -{ register,methods }
 */
export default function useDialog(props: CLDialogProps = {}) {
  const methods = shallowRef({} as CLDialogAction);
  function register(instance: CLDialogAction) {
    methods.value = instance;
    instance.setProps(props);
  }

  return { register, methods };
}
